package com.sl.au.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import com.sl.au.entity.ExdeBeforeContract;
import com.sl.au.entity.ExdeBeforeContractDetails;
import com.sl.au.entity.User;

/***
 * 
 * @author chuck
 * 20170224 合同签订前审批合同合同标的物子表DAO
 */

public interface ExdeBeforeContractDetailsRepository extends JpaRepository<ExdeBeforeContractDetails, String>{
	
	@Transactional
	@Modifying
	@Query("delete from ExdeBeforeContractDetails c where c.id=? ")
	void deleteById(String id);
	
	/**
	 * 通过当前用户部门得到该部门下所有人员
	 * 
	 * @param superior
	 *            部门
	 * @return
	 */
	@Query("select u from User u where u.saleArea.superior=?1 ")
	List<User> getAllSuperiorMenBySuperior(String superior);

}
